/**
 * 信息存存储管理
 * @author wuxie QQ:16349023
 * @date 2019-3-21
 */
define('TokenStore',['cookie','siteConfig'], function (cookie, siteConfig) {
    var TokenStore=function (tokenCookieName) {
        this.tokenCookieName=tokenCookieName;
    }
    TokenStore.prototype.setToken=function(token){
        cookie.set(this.tokenCookieName, token, { expires: siteConfig.cookieExpires || 1 })
    }
    TokenStore.prototype.getToken=function () {
        return cookie.get(this.tokenCookieName);
    }
    TokenStore.prototype.exists=function(){
        let token=this.getToken();
        if(!token || token===''){
            return false;
        }else {
            return true;
        }
    }
    TokenStore.prototype.clearToken=function () {
        cookie.remove(this.tokenCookieName);
    }
    return new TokenStore(siteConfig.tokenCookieName);
})